﻿#include <functional>
#include <iostream>

#include "map_system.h"
#include "move_component.h"

void MoveCallback(bool, EStopMoveReason) {
  std::cout << "MoveCallback" << std::endl;
}

int main() {
  MapSystem map_system(RegionSystemType::kMap, 1200, 1200);
  map_system.Init();

  EntityPtr entity(new Entity(map_system, EntityType::kEntityType_Town));
  Vector2D obstacle_position;
  obstacle_position.SetX(2 * kGridSize);
  obstacle_position.SetY(2 * kGridSize);
  entity->Init(Vector2D(0, 0), ZNumber(1.0f * kGridSize), ZNumber(1.0f * kGridSize), obstacle_position);

  EntityPtr start_entity(new Entity(map_system, EntityType::kEntityType_March));
  Vector2D start_position;
  start_position.SetX(1 * kGridSize);
  start_position.SetY(5 * kGridSize);
  start_entity->Init(Vector2D(0, 0), ZNumber(0.0f), ZNumber(0.0f), start_position);

  MoveComponent move_component(&map_system, start_entity.get());

  Vector2D move_pos;
  move_pos.SetX(5 * kGridSize);
  move_pos.SetY(1 * kGridSize);

  move_component.MoveTo(move_pos, std::bind(MoveCallback, std::placeholders::_1,
                                            std::placeholders::_2));
}
